#!/bin/sh

tar xf /dev/stdin

for i in $(find src -name "*.proto"); do \
	protoc \
		-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
		-I${GOPATH}/src/github.com/gogo/protobuf \
		-I${GOPATH}/src \
		-Isrc \
		--gofast_out=plugins=grpc,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,\
Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,\
Mclient/pfs/pfs.proto=github.com/pachyderm/pachyderm/src/client/pfs,\
Mclient/pps/pps.proto=github.com/pachyderm/pachyderm/src/client/pps,\
Mclient/auth/auth.proto=github.com/pachyderm/pachyderm/src/client/auth,\
Mserver/pfs/fuse/fuse.proto=github.com/pachyderm/pachyderm/src/server/pfs/fuse,\
:src \
	${i} ; \
done

find src -regex ".*\.go" | xargs tar cf -
